import http from "@/api/index";

// 字典列表
export const getDictAll = () => {
  return http.get<BaseResponse>(`/dictionary/get_all`);
};

// 字典列表
export const getDictList = data => {
  return http.get<BaseResponse>(`/dictionary/list`, data);
};

// 字典类型列表
export const getDictType = () => {
  return http.get(`/dictionary/type/all`);
};

// 添加字典
export const addDict = data => {
  return http.post(`/dictionary/add`, data);
};

// 更新字典
export const editDict = data => {
  return http.post(`/dictionary/update`, data);
};

// 删除字典
export const delDict = ids => {
  return http.post(`/dictionary/delete`, ids);
};

// 字典详情
export const detailDict = id => {
  return http.get<Dict>(`/dictionary/detail?id=${id}`);
};

export interface Dict {
  id?: number;
  name?: string;
  code?: string;
  type: string;
  desc?: string;
  is_edit?: number;
  status: number;
}
